<template>
  <div>
    
     <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="dname" label="用户名" width="180">
      </el-table-column>
      <el-table-column prop="dage" label="年龄" width="180">
      </el-table-column>
      <el-table-column prop="dsex" label="性别" width="180">
      </el-table-column>
      <el-table-column prop="dtel" label="手机号" width="180">
      </el-table-column>
      <el-table-column prop="dhospital" label="所属医院" width="180">
      </el-table-column>
      <el-table-column prop="title" label="职称" width="180">
      </el-table-column>
      <!-- <el-table-column prop="depid" label="科室名称" width="180">
      </el-table-column> -->
       <el-table-column prop="daddress" label="联系地址" width="180">
      </el-table-column>
       <el-table-column label="沟通" width="280">

      
          <el-button @click="liaotian">聊天</el-button>
       </el-table-column>   
        
    </el-table> -->
     <!--分页的实现-->
      <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageParam.pageNum"
      :page-sizes="pageSizeS"
      :page-size="pageParam.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="pageParam.total"
    >
    </el-pagination>
  </div>
</template>
<script> 
export default {
  mounted() {
    this.updateTable();
    
    
    
    
  },
  data() {
    return {
      tableData: [],
      ddid: [],
      dialogFormVisible: false,
      dialogFormVisible2: false,
      pageSizeS: [1, 2, 20, 50],
      total: 1,
      pageParam: {
        pageNum: 1,
        pageSize: 1,
        total:0,
        
      },
      
      formLabelWidth: "120px",
    };
  },
  methods: {
    updateTable() {
      // let pid = 1;
      let pid = JSON.parse(sessionStorage.getItem("pat")).pid
      this.$axios.post("http://localhost:8000/patient-serv/patientinfo/findDoctorId/"+pid).then((response) => {
          let r = response.data;
          this.ddid = r.data.data;
      
      
      //console.log(this.ddid);
      let did = this.ddid;
      
      let pageNow = this.pageParam.pageNum;
      let pageSize =this.pageParam.pageSize;
      this.$axios
        .post("http://localhost:8000/patient-serv/patientinfo/getDoctorByDids", {did:did,pageNow:pageNow,pageSize:pageSize})
        .then((response) => {
          let r = response.data;
          this.pageParam.total = r.data.data.total;
          //alert(this.pageParam.total)
          this.tableData = r.data.data.list;
          //console.log(this.tableData);
        })
        });
    },
    
    //每页显示几条
    handleSizeChange(size) {
      
      this.pageParam.pageSize = size;
      this.updateTable();
    },
    //页数更改时
    handleCurrentChange(num) {
      
      this.pageParam.pageNum = num;
      this.updateTable();
      
    },
    liaotian(){
      
    }
    
  }
};
</script>

<style>
</style>